package psi

import (
	"fmt"
	"strings"
)

/*
喝水闹钟设置指令
平台发送:
[DW*YYYYYYYYYYYYYYY*LEN*REMIND_CH_DRINK,时间间隔（小时）,开关（0 为关，1 为开）]
实例:
[DW*334588000000156*0026*REMIND_CH_DRINK,4,0]
终端回复:
[DW*YYYYYYYYYYYYYYY*LEN*REMIND_CH_DRINK]
实例:[DW*334588000000156*000E*REMIND_CH_DRINK
*/

// 喝水闹钟设置指令
type REMIND_CH_DRINK struct {
	Interval int // 时间间隔（小时）
	Switch   int // 开关（0 为关，1 为开）
}

func DealREMIND_CH_DRINK(method string, params map[string]interface{}) (string, error) {
	var remind REMIND_CH_DRINK
	err := MapToStruct(params, &remind)
	if err != nil {
		return "", err
	}
	var messageList []string
	messageList = append(messageList, "REMIND_CH_DRINK")
	messageList = append(messageList, fmt.Sprint(remind.Interval))
	messageList = append(messageList, fmt.Sprint(remind.Switch))
	message := strings.Join(messageList, ",")
	return message, nil
}
